package com.xiangyang.controller;

import com.xiangyang.entity.Department;
import com.xiangyang.entity.dto.Result;
import com.xiangyang.service.impl.DepartmentImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/department")
@CrossOrigin
public class DepartmentController {
    @Autowired
    public DepartmentImpl dep;
    @PostMapping("/adddepaetment")
      public Result addDepartment(Department department){
      return dep.addDepartment(department);
    }
    @PostMapping("/deletedepartment")
    public Result deleteDepartment(Long departmentId){
      return dep.deleteDepartment(departmentId);
    }
    @PostMapping("/updatedepartment")
    public Result updateDepartment(Department department){
      return dep.updateDepartment(department);
    }

    @PostMapping("/querydepartment")
    public Result getDepartmentList(Department department){
      return dep.getDepartmentList(department);
    }
    @PostMapping("/querydepartmentlist")
    public Result getDepartmentList(){
      return dep.getDepartmentList();
    }
}
